package NB;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

import track2.context.Config;

import track2.result.Result;
import track2.result.ResultFileTool;

public class nbRun {

	public static void naivebayes() {
		nbFeature feature = nbTrain.train();
		// NaiveBayesFeatures feature = NaiveBayesFeatures.getObject();
		nbFeature.putObject(feature);

		// test1
//		Result result = nbTest.test(feature, Config.testFilePath);
//		ResultFileTool.outputResult(result, Config.nbTestResultPath);

		// test2
		// result = TestClassifier.test(feature, Config.sampleTestFilePath);
		// ResultFileTool.outputResult(result, Config.nbSampleTestResultPath);

		// NaiveBayesFeatures.putObject(feature);

	}

	public static void idNaivebayes() throws IOException,
			ClassNotFoundException {
		IdnbFeature feature = IdnbTrain.train();
		IdnbFeature.putObject(feature);

		// test1
		Result result = IdnbTest.test(feature, Config.testFilePath);
		ResultFileTool.outputResult(result, Config.idnbTestResultPath);

		// test2
		// result = IdTestClassifier.test(feature, Config.sampleTestFilePath);
		// ResultFileTool.outputResult(result, Config.idnbSampleTestResultPath);

	}

	public static void test() throws IOException, ClassNotFoundException {
		IdnbFeature feature = (IdnbFeature) IdnbFeature.getObject();
		Result result = IdnbTest.test(feature, Config.trainingFilePath);
		ResultFileTool.outputResult(result, Config.idnbTestResultPath);
	}

	public static void main(String[] args) throws IOException,
			ClassNotFoundException {
		// run naive bayes model
		//naivebayes();
		 //idNaivebayes();
		//idNaivebayes();

		// lr();
		 test();

	}

}
